package com.utf999.qiangmanger.entity.orm;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.utf999.qiangmanger.entity.UUIDEntity;

/**
 * 存储了“消费型”工单和商品的对应管理
 * @author yinwenjie
 *
 */
@Entity
@Table(name="O_OrderinfoCommodity")
public class OrderInfoCommodityEntity extends UUIDEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5813211150308579272L;

	/**
	 * 对应的工单信息
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="orderInfo" , nullable=false)
	private OrderInfoEntity orderInfo;
	
	/**
	 * 对应的商品信息
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="commodify" , nullable=false)
	private CommodityEntity commodify;
	
	/**
	 * 这个工单所绑定的这个商品的销售数量
	 */
	@Column(name="commodifyNumber" , nullable=false)
	private Integer commodifyNumber;
	
	public OrderInfoEntity getOrderInfo() {
		return orderInfo;
	}

	public void setOrderInfo(OrderInfoEntity orderInfo) {
		this.orderInfo = orderInfo;
	}

	public CommodityEntity getCommodify() {
		return commodify;
	}

	public void setCommodify(CommodityEntity commodify) {
		this.commodify = commodify;
	}

	public Integer getCommodifyNumber() {
		return commodifyNumber;
	}

	public void setCommodifyNumber(Integer commodifyNumber) {
		this.commodifyNumber = commodifyNumber;
	}

	/* (non-Javadoc)
	 * @see com.utf999.qiangmanger.entity.UUIDEntity#getUniqueKey()
	 */
	@Override
	public String getUniqueKey() {
		return "uid";
	}
}
